package club.itstudio.IContainer.controller.student;


import club.itstudio.IContainer.annotation.LoginRequired;
import club.itstudio.IContainer.annotation.StudentRequired;
import club.itstudio.IContainer.annotation.TeacherRequired;
import club.itstudio.IContainer.entity.WebMenu;
import club.itstudio.IContainer.util.Result;
import club.itstudio.IContainer.util.ResultUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/student/menu")
public class StudentWebMenuController {

    private static List<WebMenu> mainMenu;

    static {
        // 主页
//        WebMenu homeMenu = new WebMenu("main", "主页", "layui-icon-home", "/", null);
        // 课程管理
        WebMenu courseMenu = new WebMenu("courseMenu", "课程列表", "layui-icon-table", "/menu/course/courseList", null);

        // 申请列表
        WebMenu applicationMenu = new WebMenu("applicationMenu", "申请列表", "layui-icon-list", "/menu/application/applicationList", null);

        // 容器列表
        WebMenu containerMenu = new WebMenu("containerMenu", "容器列表", "layui-icon-app", "/menu/container/containerList", null);

        // 总菜单
        mainMenu = new ArrayList<>(Arrays.asList(courseMenu, applicationMenu, containerMenu));
    }

    @LoginRequired
    @StudentRequired
    @GetMapping
    public Result getTeacherWebMenu() {
        return ResultUtil.success(mainMenu);
    }
}
